﻿<UserControl x:Class="LinkViewer.Controls.LinkItem"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:chr="clr-namespace:Cjc.ChromiumBrowser;assembly=Cjc.ChromiumBrowser"
             xmlns:s="clr-namespace:LinkViewer"
			 mc:Ignorable="d" 
			 x:Name="root"
             SizeChanged="root_SizeChanged" Loaded="root_Loaded" Margin="0,0,15,0">
	<UserControl.Resources>
        <ControlTemplate x:Key="loadingAnimation">
            <ControlTemplate.Triggers>
                <Trigger Property="Visibility" Value="Visible">
                    <Trigger.EnterActions>
                        <BeginStoryboard Name="animation">
                            <Storyboard Storyboard.DesiredFrameRate="15">
                                <DoubleAnimation From="0" To="359" Duration="0:0:3" RepeatBehavior="Forever"
												 Storyboard.TargetName="angle" Storyboard.TargetProperty="Angle"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <StopStoryboard BeginStoryboardName="animation"/>
                    </Trigger.ExitActions>
                </Trigger>
            </ControlTemplate.Triggers>
            <Image Name="content" Opacity="1">
                <Image.Source>
                    <DrawingImage>
                        <DrawingImage.Drawing>
                            <DrawingGroup>
                                <GeometryDrawing Brush="Transparent">
                                    <GeometryDrawing.Geometry>
                                        <RectangleGeometry Rect="0,0,1,1"/>
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                                <DrawingGroup>
                                    <DrawingGroup.Transform>
                                        <RotateTransform x:Name="angle" Angle="0" CenterX="0.5" CenterY="0.5"/>
                                    </DrawingGroup.Transform>
                                    <GeometryDrawing>
                                        <GeometryDrawing.Pen>
                                            <Pen Brush="Green" Thickness="0.1"/>
                                        </GeometryDrawing.Pen>
                                        <GeometryDrawing.Geometry>
                                            <PathGeometry>
                                                <PathFigure StartPoint="0.9,0.5">
                                                    <ArcSegment Point="0.5,0.1" RotationAngle="90" SweepDirection="Clockwise" IsLargeArc="True" Size="0.4,0.4"/>
                                                </PathFigure>
                                            </PathGeometry>
                                        </GeometryDrawing.Geometry>
                                    </GeometryDrawing>
                                    <GeometryDrawing Brush="Green">
                                        <GeometryDrawing.Geometry>
                                            <PathGeometry>
                                                <PathFigure StartPoint="0.5,0">
                                                    <LineSegment Point="0.7,0.1" />
                                                    <LineSegment Point="0.5,0.2" />
                                                </PathFigure>
                                            </PathGeometry>
                                        </GeometryDrawing.Geometry>
                                    </GeometryDrawing>
                                </DrawingGroup>
                            </DrawingGroup>
                        </DrawingImage.Drawing>
                    </DrawingImage>
                </Image.Source>
            </Image>
        </ControlTemplate>
		<ControlTemplate x:Key="Elevate_Template" TargetType="{x:Type Button}">
			<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="1,1,1,1" CornerRadius="3,0,0,3">
					<Image Width="85" Height="22" x:Name="Normal1" Source="../Graphics/Elevate.png"></Image>
				</Border>
				<Label FontSize="12" HorizontalAlignment="Center">Elevate</Label>
			</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="DeElevate_Template" TargetType="{x:Type Button}">
			<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="1,1,1,1" CornerRadius="3,0,0,3">
					<Image Width="85" Height="22" x:Name="Normal1" Source="../Graphics/DeElevate.png"></Image>
				</Border>
				<Label FontSize="12" HorizontalAlignment="Center">De-Elevate</Label>
			</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="Suspend_Template" TargetType="{x:Type Button}">
			<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="1,1,1,1" CornerRadius="0,3,3,0">
					<Image Width="100" Height="22" x:Name="Normal1" Source="../Graphics/Suspend.png"></Image>
				</Border>
				<Label FontSize="12" HorizontalAlignment="Center">Suspend</Label>
			</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="UnSuspend_Template" TargetType="{x:Type Button}">
			<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="1,1,1,1" CornerRadius="0,3,3,0">
					<Image Width="100" Height="22" x:Name="Normal1" Source="../Graphics/UnSuspend.png"></Image>
				</Border>
				<Label FontSize="12" HorizontalAlignment="Center">Un-Suspend</Label>
			</StackPanel>
		</ControlTemplate>
        <ControlTemplate x:Key="Delete_Template" TargetType="{x:Type Button}">
            <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="1,1,0,1" CornerRadius="3,0,0,3">
                    <Image Width="65" Height="22" x:Name="Normal1" Source="../Graphics/Delete-Button.png"></Image>
                </Border>
                <Label FontSize="12" HorizontalAlignment="Center">Delete</Label>
            </StackPanel>
        </ControlTemplate>
        <ControlTemplate x:Key="SaveButtonTemplate" TargetType="{x:Type Button}">
			  <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="0,1,1,1" CornerRadius="0,3,3,0">
										<Image Width="43" Height="22" x:Name="Normal1" Source="../Graphics/Save-Button.png"></Image>
									</Border>
									<Label FontSize="12" HorizontalAlignment="Center">Save</Label>
								</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="SearchButtonTemplate" TargetType="{x:Type Button}">
			  <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
									<Border BorderBrush="Gray" BorderThickness="0,1,1,1">
										<Image Width="65" Height="22" x:Name="Normal1" Source="../Graphics/Search-Button.png"></Image>
									</Border>
									<Label FontSize="12" HorizontalAlignment="Center">Search</Label>
								</StackPanel>
		</ControlTemplate>
        <ControlTemplate x:Key="WikiTemplate" TargetType="{x:Type Button}">
            <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="0,1,0,1">
                    <Image Width="77" Height="22" x:Name="Normal1" Source="../Graphics/wikipedia.png"></Image>
                </Border>
                <Label FontSize="12" HorizontalAlignment="Center">Search</Label>
            </StackPanel>
        </ControlTemplate>
        <ControlTemplate x:Key="OpenContainerTemplate" TargetType="{x:Type Button}">
			  <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
									<Border BorderBrush="Gray" BorderThickness="1,1,1,1">
										<Image Width="125" Height="22" Stretch="Fill" x:Name="Normal1" Source="../Graphics/OpenContainerPage-Button.png"></Image>
									</Border>
									<Label FontSize="12" HorizontalAlignment="Center">Open Container Page</Label>
								</StackPanel>
		</ControlTemplate>
        <ControlTemplate x:Key="OpenLPETemplate" TargetType="{x:Type Button}">
            <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="1,1,0,1">
                    <Image Width="100" Height="22" Source="../Graphics/LPE.png"></Image>
                </Border>
                <Label FontSize="12" HorizontalAlignment="Center">Open in LPE</Label>
            </StackPanel>
        </ControlTemplate>
        <ControlTemplate x:Key="OpenInBrowserTemplate" TargetType="{x:Type Button}">
			  <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
									<Border BorderBrush="Gray" BorderThickness="0,1,1,1">
										<Image Width="100" Height="22" x:Name="Normal1" Source="../Graphics/OpenInBrowser-Button.png"></Image>
									</Border>
									<Label FontSize="12" HorizontalAlignment="Center">Open In Browser</Label>
								</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="ReloadPageTemplate" TargetType="{x:Type Button}">
			<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
				<Border BorderBrush="Gray" BorderThickness="0,1,1,1">
					<Image Width="75" Height="22" Stretch="Fill"  x:Name="Normal1" Source="../Graphics/ReloadPage-Button.png"></Image>
				</Border>
				<Label FontSize="12" HorizontalAlignment="Center">Reload Page</Label>
			</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="StopPageTemplate" TargetType="{x:Type Button}">
			<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
				<Border BorderBrush="Gray" BorderThickness="0,1,1,1">
					<Image Width="100" Height="22" x:Name="Normal1" Source="../Graphics/StopPage-Button.png"></Image>
				</Border>
				<Label FontSize="12" HorizontalAlignment="Center">Stop Page</Label>
			</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Key="CopyItemTemplate" TargetType="{x:Type Button}">
			  <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
									<Border BorderBrush="Gray" BorderThickness="0,1,1,1">
										<Image Width="85" Height="22" Source="../Graphics/Copy-Button.png"></Image>
									</Border>
									<Label FontSize="12" HorizontalAlignment="Center">Copy To Cells</Label>
								</StackPanel>
		</ControlTemplate>
        <ControlTemplate x:Key="WhitelistTemplate" TargetType="{x:Type Button}">
            <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Border BorderBrush="Gray" BorderThickness="0,1,0,1">
                    <Image Width="85" Height="22" Source="../Graphics/Whitelist.png"></Image>
                </Border>
                <Label FontSize="12" HorizontalAlignment="Center">Whitelist</Label>
            </StackPanel>
        </ControlTemplate>
        <ControlTemplate x:Key="UseCurrentTemplate" TargetType="{x:Type Button}">
			  <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
									<Border BorderBrush="Gray" BorderThickness="0,1,1,1">
										<Image Width="83" Height="22" Source="../Graphics/UseCurrent-Button.png"></Image>
									</Border>
									<Label FontSize="12" HorizontalAlignment="Center">Use Current</Label>
								</StackPanel>
		</ControlTemplate>
	</UserControl.Resources>
	<Border HorizontalAlignment="Stretch" BorderBrush="#FF6C6C6C" BorderThickness="1" CornerRadius="4" Margin="10" Padding="5" >
		<Border.Background>
			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
				<GradientStop Color="#FFCCCCCC"/>
				<GradientStop Color="#FFC4C4C4" Offset="1"/>
				<GradientStop Color="#FFBEBDBD" Offset="0.092"/>
				<GradientStop Color="#FFDEDEDE" Offset="0.924"/>
			</LinearGradientBrush>
		</Border.Background>

		<DockPanel HorizontalAlignment="Stretch">
			<Grid HorizontalAlignment="Stretch">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="500"></ColumnDefinition>
					<ColumnDefinition Width="*"></ColumnDefinition>
					<ColumnDefinition Width="500"></ColumnDefinition>
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					
					<RowDefinition/>
                    <RowDefinition Height="{Binding Source={x:Static s:Properties.Settings.Default}, Path=BrowserSize, Mode=TwoWay}"/>
                    <RowDefinition/>
                    <RowDefinition/>
				</Grid.RowDefinitions>
                <StackPanel Grid.Row="0" Grid.ColumnSpan="3">
                    <Label x:Name="lblWarning" HorizontalAlignment="Center" FontFamily="Segoe UI" Foreground="Red" FontSize="18" FontWeight="Bold" Visibility="Collapsed">Browser and Current Page are not synced!</Label>
                    <Label FontSize="14" x:Name="lblPageName">Testing</Label>
                    <Slider x:Name="zoomSlider" Maximum="500" Minimum="25" Value="100" ValueChanged="zoomSlider_ValueChanged"></Slider>
                </StackPanel>
                  
                
                <Border Grid.Row="1" Grid.ColumnSpan="3" x:Name="yo" BorderBrush="Orange" BorderThickness="2">
         
			       <chr:WebBrowser x:Name="chromeBrowser" Ready="chromeBrowser_Ready" Margin="5" Height="{Binding Source={x:Static s:Properties.Settings.Default}, Path=BrowserSize, Mode=TwoWay}" Source="{Binding ElementName=root, Path=LinkObject.URL}" Width="{Binding ElementName=yo, Path=Width}" BorderThickness="2">
					    <chr:WebBrowser.Effect>
						    <DropShadowEffect BlurRadius="6" Color="#FF4E4E4E" Direction="274" ShadowDepth="2" Opacity="0.23"/>
					    </chr:WebBrowser.Effect>
				    </chr:WebBrowser>
                </Border>
                <StackPanel Grid.Row="2" Orientation="Vertical" Margin="3" HorizontalAlignment="Stretch">
                    <Label x:Name="lblCurrentTitle" HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"  Content="{Binding ElementName=root,Path=LinkObject.Title}"></Label>
                    <TextBox HorizontalAlignment="Stretch" x:Name="tbNewTitle" FontFamily="Arial" FontSize="14" BorderThickness="2">
                        <TextBox.Effect>
                            <DropShadowEffect BlurRadius="6" Color="#FF4E4E4E" Direction="274" ShadowDepth="2" Opacity="0.23"/>
                        </TextBox.Effect>
                    </TextBox>
                    
                </StackPanel>
                <Control Name="loading" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Template="{StaticResource loadingAnimation}" Foreground="Green"
					 Width="20" Margin="5,25,0,5" Visibility="Collapsed" />
                <StackPanel Grid.Row="2" Grid.Column="2" Orientation="Vertical" Margin="3" HorizontalAlignment="Stretch">
                    <Label x:Name="lblCurrentURL" FontSize="16" FontFamily="Arial" HorizontalAlignment="Stretch" Content="{Binding ElementName=root, Path=LinkObject.URL}"></Label>
                    <TextBox HorizontalAlignment="Stretch" x:Name="tbNewURL" FontFamily="Arial" FontSize="14" Text="" BorderThickness="2">
                        <TextBox.Effect>
                            <DropShadowEffect BlurRadius="6" Color="#FF4E4E4E" Direction="274" ShadowDepth="2" Opacity="0.23"/>
                        </TextBox.Effect>
                    </TextBox>
                </StackPanel>
                <StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Right" Orientation="Vertical">
                    
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
                        <Button Name="bDeleteLink" Click="bDeleteLink_Click" Template="{DynamicResource Delete_Template}">Delete</Button>
                        <Button Template="{DynamicResource OpenLPETemplate}" Name="bOpenInLPE" Click="bOpenInLPE_Click">Open in LPE</Button>
                        <Button Click="bOpenContainerPage_Click" Width="125" x:Name="bOpenContainerPage"  Template="{StaticResource OpenContainerTemplate}"></Button>
                        <Button Width="75" x:Name="bReloadPage" Visibility="Collapsed" Click="bReloadPage_Click" Margin="0" Template="{DynamicResource ReloadPageTemplate}" HorizontalAlignment="Left"/>
                        <Button Width="66" x:Name="bStopPage" Click="bStopPage_Click" Margin="0" Template="{DynamicResource StopPageTemplate}" HorizontalAlignment="Left"/>
                        <Button Click="bCopyToCells_Click" x:Name="bCopyToCells" Content="Button" HorizontalAlignment="Right" Margin="0" Template="{DynamicResource CopyItemTemplate}"/>       
                        <Button Click="bUseCurrentPage_Click" Width="83" x:Name="bUseCurrentPage" Content="Button" Margin="0" Template="{DynamicResource UseCurrentTemplate}" HorizontalAlignment="Left"/>
                        <Button Click="bOpenInBrowser_Click" Width="100" x:Name="bOpenInBrowser" Content="Button" Margin="0" Template="{DynamicResource OpenInBrowserTemplate}" HorizontalAlignment="Left"/>
                        <Button Click="bSearch_Click" Width="65" x:Name="bSearch" Template="{StaticResource SearchButtonTemplate}"></Button>
                        <Button Width="77"  Click="Wikipedia_Click" Template="{StaticResource WikiTemplate}"  Name="Wikipedia">WikiPedia</Button>
                        <Button Click="bSaveItem_Click" Width="44" x:Name="bSaveItem" Template="{StaticResource SaveButtonTemplate}"></Button>


                        <Button Margin="15,0,0,0" Name="bElevateLink" Template="{DynamicResource Elevate_Template}" Click="bElevateLink_Click">Elevate Link</Button>
                        <Button Margin="15,0,0,0" Name="bUnElevateLink" Template="{DynamicResource DeElevate_Template}" Click="bUnElevateLink_Click">UnElevate Link</Button>
                        <Button Template="{DynamicResource WhitelistTemplate}" Name="bAddToWhiteList" Click="bAddToWhiteList_Click">Whitelist</Button>
                        <Button Name="bSuspendLink" Template="{DynamicResource Suspend_Template}" Click="bSuspendLink_Click">Suspend Link</Button>
                        <Button Name="bUnSuspendLink" Template="{DynamicResource UnSuspend_Template}" Click="bUnSuspendLink_Click">Unsuspend Link</Button>
                        
                        
                    </StackPanel>
                </StackPanel>
           
			</Grid>
		</DockPanel>
	</Border>
</UserControl>
